<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">甲方管理</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix" style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"/>

                        <p:columnToggler datasource="LoanWholeSaleCommentDataTable" trigger="toggler"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         rendered="#{loanWholeSaleCommentBean.isNormal()}"
                                         update="@form"/>
                        <p:commandButton value="禁用" icon="fa fa-times"
                                         rendered="#{loanWholeSaleCommentBean.isBatch()}"
                                         actionListener="#{loanWholeSaleCommentBean.onBatchDisable()}"
                                         update="@form"/>
                        <p:commandButton value="启用" icon="fa fa-check"
                                         rendered="#{loanWholeSaleCommentBean.isBatch()}"
                                         actionListener="#{loanWholeSaleCommentBean.onBatchEnable()}"
                                         update="@form"/>
                        <p:commandButton value="重置" icon="fa fa-refresh"
                                         rendered="#{loanWholeSaleCommentBean.isNormal()}"
                                         actionListener="#{loanWholeSaleCommentBean.onReset}"
                                         process="@this" update="@form"/>
                        <p:commandButton value="新建" icon="fa fa-plus"
                                         action="#{loanWholeSaleCommentBean.add()}"
                                         process="@this" update="@form"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="ui-g-12 card">
                            <h1>查询条件</h1>
                            <div class="ui-g-1">
                                <p:outputLabel for="partnerNameInput" value="甲方名称"/>
                            </div>
                            <div class="ui-g-3">
                                <p:inputText id="partnerNameInput" value="#{loanWholeSaleCommentBean.$.ownername}"/>
                            </div>
                            <div class="ui-g-1">
                                <p:outputLabel value="在线状态"/>
                            </div>
                            <div class="ui-g-3">
                                <p:selectOneMenu id="query_status" value="#{loanWholeSaleCommentBean.$.status}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="上线中" itemValue="1"/>
                                    <f:selectItem itemLabel="已下线" itemValue="0" />
                                </p:selectOneMenu>
                            </div>
                        </div>
                        <div class="card">
                            <p:dataTable id="LoanWholeSaleCommentDataTable"
                                         style="width: 100%;text-align:center"
                                         var="prepaid"
                                         value="#{loanWholeSaleCommentBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         reflow="true"
                                         selection="#{loanWholeSaleCommentBean.selectedRecords}"
                                         resizableColumns="true">
                                <p:column headerText="操作" style="width:70px;" rendered="#{loanWholeSaleCommentBean.isNotBatch()}">
                                    <p:splitButton icon="fa fa-credit-card"
                                                   action="#{loanWholeSaleCommentBean.edit(prepaid.id)}"
                                                   process="@this" update="@form">
                                        <p:menuitem value="下线" icon="fa fa-times"
                                                    actionListener="#{loanWholeSaleCommentBean.OnDown(prepaid)}"
                                                    rendered="#{prepaid.isEnable()}"
                                                    process="@this" update="@form"/>
                                        <p:menuitem value="上线" icon="fa fa-check"
                                                    actionListener="#{loanWholeSaleCommentBean.OnUpper(prepaid)}"
                                                    rendered="#{prepaid.isDisable()}"
                                                    process="@this" update="@form"/>
                                        <p:menuitem value="删除" icon="fa fa-check"
                                                    actionListener="#{loanWholeSaleCommentBean.OnDelete(prepaid)}"
                                                    process="@this" update="@form">
                                        <p:confirm header="信息提示" message="确定删除么？" icon="ui-icon-alert" width="10%"/>
                                        </p:menuitem>
                                    </p:splitButton>
                                </p:column>
                                <p:column headerText="甲方名称">
                                    <h:outputText value="#{prepaid.ownername}"/>
                                </p:column>
                                <p:column headerText="排序" style="text-align:left;">
                                    <h:outputText value="#{prepaid.sort}"/>
                                </p:column>
                                <p:column headerText="API编号" style="text-align:right;">
                                    <h:outputText value="#{prepaid.type}"/>
                                </p:column>
                                <p:column headerText="限量" style="text-align:right;">
                                    <h:outputText value="#{prepaid.number}"/>
                                </p:column>
                                <p:column headerText="状态">
                                    <h:outputText value="#{loanWholeSaleCommentBean.translateStatus(prepaid.status)}"/>
                                </p:column>
                                <p:column headerText="上线时间" style="text-align:right;">
                                    <h:outputText value="#{loanWholeSaleCommentBean.showDate(prepaid.uppertime)}"/>
                                </p:column>
                                <p:column headerText="下线时间">
                                    <h:outputText value="#{loanWholeSaleCommentBean.showDate(prepaid.downtime)}"/>
                                </p:column>
                                <p:column headerText="在线周期">
                                    <h:outputText value="#{prepaid.onlinedate}"/>
                                </p:column>
                                <p:column headerText="件均价">
                                    <h:outputText value="#{prepaid.avgprice}"/>
                                </p:column>
                                <p:column headerText="申请人数">
                                    <h:outputText value="#{prepaid.approvenum}"/>
                                </p:column>
                                <p:column headerText="合作伙伴">
                                    <h:outputText value="#{prepaid.cooperate}"/>
                                </p:column>
                                <p:column headerText="贷款金额">
                                    <h:outputText value="#{prepaid.amount}"/>
                                </p:column>

                                <p:column headerText="操作人">
                                    <h:outputText value="#{prepaid.editor}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
